package demo.spring.store;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * @Description:
 * @Author:tyzhang
 * @Date: Created in 15:25 2018/3/19
 */
@Configuration
@ImportResource("classpath:spring-store.xml")
public class StoreConfig {

    @Value("${url}")
    private String url;

    @Value("${jdbc.username}")
    private String username;

    @Value("${password}")
    private String password;

    @Bean(name = "store")
    public Store stringStore() {
        return new StringStore();
    }

    @Bean
    public MyDriverManager myDriverManager() {
        System.out.println("1111111");
        return new MyDriverManager(url, username, password);
    }
}
